<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>直播1</title>
    <style>
        /* 页面样式 */
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
        }

        .header {
            display: flex;
            justify-content: space-around;
            align-items: center;
            background-color: #e8f5e9;
            padding: 10px;
        }

        .header div {
            font-size: 18px;
            font-weight: bold;
            cursor: pointer;
        }

        .search-bar {
            display: flex;
            justify-content: center;
            padding: 10px;
        }

        .search-bar input {
            width: 80%;
            padding: 8px;
            border-radius: 20px;
            border: 1px solid #ccc;
        }

        .content {
            padding: 20px;
        }

        .recommendation, .playlist {
            margin-bottom: 20px;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
        }

        .recommendation-item, .playlist-item {
            width: 48%; /* 调整图片大小和布局 */
            margin-bottom: 20px;
            position: relative; /* 相对定位 */
            display: flex;
            flex-direction: column;
            align-items: center;
            cursor: pointer;
            transition: transform 0.3s ease-in-out;
        }

        .recommendation-item:hover, .playlist-item:hover {
            transform: scale(1.1);
        }

        .recommendation-item img, .playlist-item img {
            width: 100%; /* 图片宽度100%，高度自适应 */
            border-radius: 8px;
        }

        .recommendation-item .text-overlay, .playlist-item .text-overlay {
            position: absolute; /* 绝对定位 */
            bottom: 10px; /* 距离底部10px */
            left: 0;
            right: 0;
            background-color: rgba(0, 0, 0, 0.5); /* 半透明背景 */
            color: #fff; /* 白色文字 */
            padding: 5px;
            text-align: center;
            border-radius: 8px;
        }

        /* 底部导航样式 */
        #bnav {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            z-index: 9;
            background-color: #e8f5e9;
            padding: 10px 0;
        }

        #bnav ul {
            display: flex;
            justify-content: space-around;
        }

        #bnav li {
            text-align: center;
        }

        #bnav svg {
            width: 24px;
            height: 24px;
            margin: 5px auto;
        }

        #bnav p {
            font-size: 14px;
            color: #333;
        }
    </style>
    <script src="./font/iconfont.js"></script>
    <link rel="stylesheet" href="./pub.css">
</head>
<body>
    <!-- 顶部导航 -->
    <div class="header">
        <div>听见</div>
        <div>看见</div>
        <div>交友</div>
        <div>互动</div>
        <div>推荐</div>
        <div>+</div>
    </div>

    <!-- 搜索栏 -->
    <div class="search-bar">
        <input type="text" placeholder="搜索主播">
    </div>

    <!-- 推荐内容 -->
    <div class="content">
        <div class="recommendation" id="recommendation">
            <!-- 推荐项内容将通过JavaScript动态生成 -->
        </div>
    </div>

    <!-- 底部导航 -->
    <nav id="bnav">
        <ul>
            <li>
                <a href="./index.html">
                    <span>
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-QQyinle"></use>
                        </svg>
                    </span>
                    <p>首页</p>
                </a>
            </li>
            <li>
                <a href="./zhibo.html">
                    <span>
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-kejian"></use> 
                        </svg>
                    </span>
                    <p>直播</p>
                </a>
            </li>
            <li>
                <a href="./leida.html">
                    <span>
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-redian"></use>
                        </svg>
                    </span>
                    <p>雷达</p>
                </a>
            </li>
            <li>
                <a href="./shequ.html">
                    <span>
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-shequ"></use>
                        </svg>
                    </span>
                    <p>社区</p>
                </a>
            </li>
            <li>
                <a href="./wode.html">
                    <span>
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-wode"></use>
                        </svg>
                    </span>
                    <p>我的</p>
                </a>
            </li>
        </ul>
    </nav>

    <script>
        var recommendationData = [
            { name: "叶薇", img: "./img/300.webp", likes: "2.2万" },
            { name: "岁儿", img: "./img/301.webp", likes: "4.9万" },
            { name: "池饱饱", img: "./img/302.webp", likes: "3.8万" },
            { name: "雾许", img: "./img/303.webp", likes: "5.0万" },
            { name: "3077", img: "./img/304.webp", likes: "6.3万" },
            { name: "亦菲", img: "./img/305.webp", likes: "2.5万" }
        ];

        var recommendation = document.getElementById('recommendation');

        recommendationData.forEach(function(item) {
            var recommendationItem = document.createElement('div');
            recommendationItem.className = 'recommendation-item';
            recommendationItem.innerHTML = `
                <img src="${item.img}" alt="${item.name}">
                <div class="text-overlay">
                    <h3>${item.name}</h3>
                    <p>${item.likes}</p>
                </div>
            `;
            recommendationItem.addEventListener('click', function() {
                alert('正在观看主播: ' + item.name);
            });
            recommendation.appendChild(recommendationItem);
        });
    </script>
</body>
</html>